<?php

namespace app\api\lists\article;

use app\admin\model\Article;
use app\api\lists\BaseApiDataLists;
use app\common\enum\YesNoEnum;

/**
 * 文章收藏列表
 * Class ArticleCollectLists
 * @package app\api\lists\article
 */
class ArticleCollectLists extends BaseApiDataLists
{

    /**
     * @notes 获取列表
     * @return array
     */
    public function lists(): array
    {
        $lists = Article::where(['status' => YesNoEnum::YES])
            ->order(['sort' => 'desc', 'id' => 'desc'])
            ->limit($this->limitOffset, $this->limitLength)
            ->select()->toArray();
        return $lists;
    }


    /**
     * @notes 获取收藏数量
     * @return int
     */
    public function count(): int
    {
        return Article::where(['status' => YesNoEnum::YES])
            ->count();
    }
}